<template>
  <div class="wrap">
    <sky-button type="primary" @click="release">发布</sky-button>
    <div class="release-wrap" v-html="message"></div>

  </div>
</template>

<script>
  export default {
    data () {
      return {
        message: ""
      }
    },
    mounted () {

    },
    methods: {
      release () {
         this.message=""
        this.$socket.emit('deploy', 'xx')
      }
    },
    sockets: {
      connect () {
        //查看socket是否连接成功
        console.log('socket connected')
      },
      deploy (data) {
        //客户端接收后台传输的socket事件
        // 事件res名字自定义 与服务端的保持一致
        this.message += `<br />${data}`
        console.log('接收到服务端消息', data) //接收的消息
      },
    },
  }
</script>

<style lang="scss" scoped>
.wrap {
  padding: 20px;
}
.release-wrap{
  min-height: 400px;
  overflow-y: scroll;
  padding: 20px;
  background: black;
  color: blue;
}
</style>